# -*- encoding: utf-8 -*-
"""

PyCharm 通过闭包函数来创建装饰器
2024年10月21日19时04分
by wenyang

文件主要内容:


"""
def count_foo():
    """
    通过闭包函数来创建记录函数调用次数的函数
    :return:
    """
    count = 0
    def count_function():
        nonlocal count
        count += 1
        print("hello world")
        return count
    return count_function

def outer():
    data = []
    def inner(value):
        data.append(value)
        return data
    return inner




def main():
    counter = count_foo()
    print(counter())
    print(counter())


if __name__ == "__main__":
    main()
